import request from '@/utils/request'
import { encryptCbc, decryptCbc } from "@/utils/aesModeCbc";

// 登录方法
export function login(username, password, code, uuid) {
  const data = {
    username: encryptCbc(username),
    password: encryptCbc(password),
    code,
    uuid
  }
  return request({
    url: '/login',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}
// 获取待办、待阅数量
export function getTaskAndReadNum() {
  return request({
    url: '/biz/workOrder/getTaskAndReadCount',
    method: 'get'
  })
}
// 注册方法
export function register(data) {
  return request({
    url: '/register',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

// 获取用户详细信息
export function getInfo() {
  return request({
    url: '/getInfo',
    method: 'get'
  })
}

// 退出方法
export function logout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}

// 获取验证码
export function getCodeImg() {
  return request({
    url: '/captchaImage',
    headers: {
      isToken: false
    },
    method: 'get',
    timeout: 20000
  })
}

// 获取系统基本信息
export function getAppBaseInfo() {
  return request({
    url: '/getAppBaseInfo',
    headers: {
      isToken: false
    },
    method: 'get',
    timeout: 20000
  })
}

// 单点登录获取token
export function ssoLogin() {
  return request({
    url: '/ssoLogin',
    method: 'get'
  })
}
